package icraf.carbon.core;

import static icraf.carbon.gui.MenuFactory.MenuProperty.*;
import static icraf.carbon.gui.MenuFactory.MenuProperty.PROJECT_SUMMARY_TOTAL_EMISSION_ELIGIBLE;
import static icraf.carbon.gui.MenuFactory.MenuProperty.PROJECT_SUMMARY_TOTAL_EMISSION_ELIGIBLE_HA;
import static icraf.carbon.gui.MenuFactory.MenuProperty.PROJECT_SUMMARY_TOTAL_EMISSION_HA;
import static icraf.carbon.gui.MenuFactory.MenuProperty.PROJECT_SUMMARY_TOTAL_SEQUESTRATION;
import static icraf.carbon.gui.MenuFactory.MenuProperty.PROJECT_SUMMARY_TOTAL_SEQUESTRATION_ELIGIBLE;
import static icraf.carbon.gui.MenuFactory.MenuProperty.PROJECT_SUMMARY_TOTAL_SEQUESTRATION_ELIGIBLE_HA;
import static icraf.carbon.gui.MenuFactory.MenuProperty.PROJECT_SUMMARY_TOTAL_SEQUESTRATION_HA;
import icraf.carbon.gui.MenuFactory.MenuProperty;

public abstract class Summary {
	public static MenuProperty summaryItems[] = {
			PROJECT_SUMMARY_TOTAL_EMISSION_HA, 
			PROJECT_SUMMARY_TOTAL_EMISSION_ELIGIBLE_HA,
			PROJECT_SUMMARY_TOTAL_SEQUESTRATION_HA,
			PROJECT_SUMMARY_TOTAL_SEQUESTRATION_ELIGIBLE_HA,
			PROJECT_SUMMARY_TOTAL_EMISSION,
			PROJECT_SUMMARY_TOTAL_EMISSION_ELIGIBLE,
			PROJECT_SUMMARY_TOTAL_SEQUESTRATION,
			PROJECT_SUMMARY_TOTAL_SEQUESTRATION_ELIGIBLE,
			
			PROJECT_SUMMARY_NET_EMISSION_HA, 
			PROJECT_SUMMARY_NET_EMISSION_ELIGIBLE_HA,
			PROJECT_SUMMARY_NET_EMISSION,
			PROJECT_SUMMARY_NET_EMISSION_ELIGIBLE};
	
//	public static MenuProperty summaryCBUItems[] = {
//			PROJECT_SUMMARY_TOTAL_COSTB_HA, 
//			PROJECT_SUMMARY_TOTAL_COSTB_ELIGIBLE_HA,
//			PROJECT_SUMMARY_TOTAL_COSTB,
//			PROJECT_SUMMARY_TOTAL_COSTB_ELIGIBLE, };

	public static double getSummaryValue(MenuProperty m, Summary s,
			Object attributes) {
		switch (m) {
		case PROJECT_SUMMARY_TOTAL_EMISSION_HA:
			return s.getEmissionPerHa();
		case PROJECT_SUMMARY_TOTAL_EMISSION:
			return s.getEmissionPerYear();
		case PROJECT_SUMMARY_TOTAL_EMISSION_ELIGIBLE_HA:
			return s.getEmissionEligiblePerHa();
		case PROJECT_SUMMARY_TOTAL_EMISSION_ELIGIBLE:
			return s.getEmissionEligiblePerYear();
		case PROJECT_SUMMARY_TOTAL_SEQUESTRATION_HA:
			return s.getSequestrationPerHa();
		case PROJECT_SUMMARY_TOTAL_SEQUESTRATION:
			return s.getSequestrationPerYear();
		case PROJECT_SUMMARY_TOTAL_SEQUESTRATION_ELIGIBLE_HA:
			return s.getSequestrationEligiblePerHa();
		case PROJECT_SUMMARY_TOTAL_SEQUESTRATION_ELIGIBLE:
			return s.getSequestrationEligiblePerYear();
		case PROJECT_SUMMARY_TOTAL_COSTB_HA:
			if (!(attributes instanceof CostBenefitUnit))
				return Double.NaN;
			return s.getTotalCostBenefitPerHa((CostBenefitUnit) attributes);
		case PROJECT_SUMMARY_TOTAL_COSTB:
			if (!(attributes instanceof CostBenefitUnit))
				return Double.NaN;
			return s.getTotalCostBenefitPerYear((CostBenefitUnit) attributes);
		case PROJECT_SUMMARY_TOTAL_COSTB_ELIGIBLE_HA:
			if (!(attributes instanceof CostBenefitUnit))
				return Double.NaN;
			return s.getTotalCostBenefitEligiblePerHa((CostBenefitUnit) attributes);
		case PROJECT_SUMMARY_TOTAL_COSTB_ELIGIBLE:
			if (!(attributes instanceof CostBenefitUnit))
				return Double.NaN;
			return s.getTotalCostBenefitEligiblePerYear((CostBenefitUnit) attributes);
			
		case PROJECT_SUMMARY_NET_EMISSION_HA:
			return s.getNetEmissionPerHa();
		case PROJECT_SUMMARY_NET_EMISSION:
			return s.getNetEmissionPerYear();
		case PROJECT_SUMMARY_NET_EMISSION_ELIGIBLE_HA:
			return s.getNetEmissionEligiblePerHa();
		case PROJECT_SUMMARY_NET_EMISSION_ELIGIBLE:
			return s.getNetEmissionEligiblePerYear();
		}
		return Double.NaN;
	}

	public abstract double getNetEmissionEligiblePerYear();

	public abstract double getNetEmissionEligiblePerHa();

	public abstract double getNetEmissionPerYear();

	public abstract double getNetEmissionPerHa();
	

	public abstract double getEmissionPerHa();

	public abstract double getEmissionPerYear();

	public abstract double getEmissionEligiblePerHa();

	public abstract double getEmissionEligiblePerYear();

	public abstract double getSequestrationPerHa();

	public abstract double getSequestrationPerYear();

	public abstract double getSequestrationEligiblePerHa();

	public abstract double getSequestrationEligiblePerYear();

	public abstract double getTotalCostBenefitPerHa(CostBenefitUnit cbu);

	public abstract double getTotalCostBenefitPerYear(CostBenefitUnit cbu);

	public abstract double getTotalCostBenefitEligiblePerHa(CostBenefitUnit cbu);

	public abstract double getTotalCostBenefitEligiblePerYear(
			CostBenefitUnit cbu);
	
	public abstract CostBenefitUnit[] getCostBenefitUnits();

}